package com.aptech.fpt.c0810g.newspj.beans;

import com.aptech.fpt.c0810g.newspj.dataaccess.NewsListAction;
import com.aptech.fpt.c0810g.newspj.entity.News;
import java.util.ArrayList;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author anhgt_b00501
 */
@ManagedBean
@RequestScoped
public class ManagerNews {

    private FacesContext contect = FacesContext.getCurrentInstance();
    private int id = 1;
    private ArrayList<News> newsList;

    public FacesContext getContect() {
        return contect;
    }

    public void setContect(FacesContext contect) {
        this.contect = contect;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public ArrayList<News> getNewsList() {
        return newsList;
    }

    public void setNewsList(ArrayList<News> newsList) {
        this.newsList = newsList;
    }

    /** Creates a new instance of ManagerNews */
    public ManagerNews() {
        getNews();
    }

    public void getNews() {
        NewsListAction newsAction = new NewsListAction();
        //  this.id = Integer.valueOf(contect.getExternalContext().getRequestParameterMap().get("id"));
        this.newsList = newsAction.getNewsListByCate(this.id);
    }
}
